// Copyright 2020 Real-Time Innovations, Inc. (RTI)
//
// Copyleft 2024, Black Sesame Technologies
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef DAL_CONNEXTDDS__CONTEXT_HPP_
#define DAL_CONNEXTDDS__CONTEXT_HPP_

#include <stdio.h>
#include <thread>
#include <limits>
#include <map>
#include <mutex>
#include <regex>
#include <string>

#include "dal_connextdds/dds_api.hpp"
#include "dal_connextdds/log.hpp"

#include "dal_msg/error_handling.h"

#include "dcutils/strdup.h"

#include "dcpputils/scope_exit.hpp"

#include "dal_msg/serialized_message.h"

extern size_t DAL_Connext_gv_ContextCount;

enum class DAL_Connext_RequestReplyMapping
{
  Basic,
  Extended
};

// Definition of struct dal_context_impl_s as declared in dal/init.h
struct dal_context_impl_s
{
  // dal_dds_common::Context common;
  dal_context_t * base;
  DAL_Connext_RequestReplyMapping request_reply_mapping;
  bool cyclone_compatible{false};

#if DAL_CONNEXT_LEGACY_DAL_COMPATIBILITY_MODE
  bool legacy_dal_compatible{false};
#endif /* DAL_CONNEXT_LEGACY_DAL_COMPATIBILITY_MODE */

#if DAL_CONNEXT_DEFAULT_LARGE_DATA_OPTIMIZATIONS
  bool optimize_large_data{true};
#endif /* DAL_CONNEXT_DEFAULT_LARGE_DATA_OPTIMIZATIONS */

  std::map<std::string, DAL_Connext_MessageTypeSupport *> registered_types;

  explicit dal_context_impl_s(dal_context_t * const base)
  : 
    base(base)
  {
  }

  ~dal_context_impl_s()
  {
  }
};


#endif  // DAL_CONNEXTDDS__CONTEXT_HPP_
